<fly:block name="list_frame">
	<fly:list name='list_photo'>
		<div id="div_frame_<fly:variable name='frame_number' />" class="b_img <fly:variable name='class_selected_image' />" style="height: <fly:variable name='height_out' />px;width: <fly:variable name='width_out' />px;">
			<img class="img_frame" id="img_<fly:variable name='frame_number' />" title="<fly:variable name='title' />" src="<fly:variable name='url_video_photo' />" width="<fly:variable name='width' />px" height="<fly:variable name='height' />px" />
			<div class="photo_title" id="title_<fly:variable name='frame_number' />"><fly:variable name='frame_number' /></div>
		</div>
	</fly:list>
	<div class="ajax_loading"></div>
	<script type="text/javascript">			
		$(document).ready(function(){
			$('.b_img').click(function(){
				$('.b_img').removeClass("media_selected");
				$(this).addClass("media_selected");
				$('#selected_frame<fly:variable name="id_fichier"/>').text($('> .photo_title',this).text());
	         });
         	$('#btn_save').click(function(){
	          		$.ajax({
					   type: "POST",
					   url: "<fly:variable name="rep_ajax"/>upload_video_image_save.php",
					   data: "thumbnail_at_frame_number="+$('#selected_frame<fly:variable name="id_fichier"/>').text().trim()+'&id_fichier='+<fly:variable name="id_fichier"/>+'&duration='+<fly:variable name="duration"/>+'&filename=<fly:variable name="video_image_name"/>&base64='+($('.b_img.media_selected > img').attr('src')).replace(/\+/g,'*'),
					   success: function(msg){
					     if(msg=='true'){
					     	$('#img<fly:variable name="id_fichier"/>').attr('src',$('.b_img.media_selected > img').attr('src'));
					     	$('#txt_selected_frame').text($('#selected_frame<fly:variable name="id_fichier"/>').text());
							$('#start_frame<fly:variable name="id_fichier"/>').text($('#selected_frame<fly:variable name="id_fichier"/>').text().trim());
					     	$('#img_main').attr('src',$('.b_img.media_selected > img').attr('src'));
					     	$.jPopup_translate.remove();
					     }else{
							$('#sms_error').text('<fly:translate name="error_1" />').show('fast');
				            if (timeout) clearTimeout(timeout);
								timeout = setTimeout(function(){
				            		$('#sms_error').fadeOut("slow");
				            }, delay_search);
					     }
					   }
					 });
	          	});
        });
	</script>
</fly:block>
<fly:block name="no_frame">
	<fly:variable name="text_message"/>
</fly:block>